
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>CSS书写规范 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="2.css命名规范.html" />
    
    
    <link rel="prev" href="0.css.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    引言
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../html/0.html.html">
            
                <a href="../html/0.html.html">
            
                    
                    HTML
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../html/1.html整体结构.html">
            
                <a href="../html/1.html整体结构.html">
            
                    
                    HTML整体结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../html/2.html代码格式.html">
            
                <a href="../html/2.html代码格式.html">
            
                    
                    HTML代码格式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../html/3.html内容语义.html">
            
                <a href="../html/3.html内容语义.html">
            
                    
                    HTML内容语义
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="0.css.html">
            
                <a href="0.css.html">
            
                    
                    CSS
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter active" data-level="1.3.1" data-path="1.css书写规范.html">
            
                <a href="1.css书写规范.html">
            
                    
                    CSS书写规范
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="2.css命名规范.html">
            
                <a href="2.css命名规范.html">
            
                    
                    CSS命名规范
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../js/0.javascript.html">
            
                <a href="../js/0.javascript.html">
            
                    
                    JavaScript
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../js/1.javascript-es6.html">
            
                <a href="../js/1.javascript-es6.html">
            
                    
                    es6
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../图片规范/图片规范.html">
            
                <a href="../图片规范/图片规范.html">
            
                    
                    图片规范
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../前端研发流程/前端研发流程.html">
            
                <a href="../前端研发流程/前端研发流程.html">
            
                    
                    前端研发流程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../项目/0.项目.html">
            
                <a href="../项目/0.项目.html">
            
                    
                    项目
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../项目/1.食尚购.html">
            
                <a href="../项目/1.食尚购.html">
            
                    
                    食尚购App
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../文档/0.文档.html">
            
                <a href="../文档/0.文档.html">
            
                    
                    文档
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="../文档/1.食尚购.html">
            
                <a href="../文档/1.食尚购.html">
            
                    
                    食尚购App
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="../文档/2.门店EDI.html">
            
                <a href="../文档/2.门店EDI.html">
            
                    
                    门店EDI
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.3" data-path="../文档/3.掌中宝.html">
            
                <a href="../文档/3.掌中宝.html">
            
                    
                    掌中宝
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.4" data-path="../文档/4.食尚购小程序.html">
            
                <a href="../文档/4.食尚购小程序.html">
            
                    
                    食尚购小程序
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >CSS书写规范</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h4 id="1css&#x4E66;&#x5199;&#x987A;&#x5E8F;">1.CSS&#x4E66;&#x5199;&#x987A;&#x5E8F;</h4>
<ol>
<li>&#x4F4D;&#x7F6E;&#x5C5E;&#x6027;(position, top, right, z-index, display, float&#x7B49;)</li>
<li>&#x5927;&#x5C0F;(width, height, padding, margin)</li>
<li>&#x6587;&#x5B57;&#x7CFB;&#x5217;(font, line-height, letter-spacing, color- text-align&#x7B49;)</li>
<li>&#x80CC;&#x666F;(background, border&#x7B49;)</li>
<li>&#x5176;&#x4ED6;(animation, transition&#x7B49;)<pre><code>/*bad*/
.example {
 color:#fff;
 z-index:-1;
 background-color:#eee;
 display:block;
 font-size:1.5em;
}
/*good*/
.example {
 z-index:-1;
 display:block;
 font-size:1.5em;
 color:#fff;
 background-color:#eee;
}
</code></pre><h4 id="2css&#x4E66;&#x5199;&#x89C4;&#x8303;">2.CSS&#x4E66;&#x5199;&#x89C4;&#x8303;</h4>
CSS&#x6709;&#x4E9B;&#x5C5E;&#x6027;&#x662F;&#x53EF;&#x4EE5;&#x7F29;&#x5199;&#x7684;&#xFF0C;&#x6BD4;&#x5982;padding,margin,font&#x7B49;&#x7B49;&#xFF0C;&#x8FD9;&#x6837;&#x7CBE;&#x7B80;&#x4EE3;&#x7801;&#x540C;&#x65F6;&#x53C8;&#x80FD;&#x63D0;&#x9AD8;&#x7528;&#x6237;&#x7684;&#x9605;&#x8BFB;&#x4F53;&#x9A8C;&#x3002;<pre><code>/*bad*/
.list-box {
 border-top-style:none;
 font-family:serif;
 font-size:100%;
 line-height:1.6;
 padding-bottom:2em;
 padding-left:1em;
 padding-right:1em;
 padding-top:0;
}
/*good*/
.list-box {
 border-top:0;
 font:100%/1.6 serif;
 padding:0 1em 2em;
}
</code></pre><h4 id="3&#x53BB;&#x6389;&#x5C0F;&#x6570;&#x70B9;&#x524D;&#x7684;0">3.&#x53BB;&#x6389;&#x5C0F;&#x6570;&#x70B9;&#x524D;&#x7684;&#x201C;0&#x201D;</h4>
<code>font-size:08.em;</code>&#x5EFA;&#x8BAE;&#x5199;&#x6210; <code>font-size:.8em;</code><h4 id="4color&#x8D4B;&#x503C;16&#x8FDB;&#x5236;&#x989C;&#x8272;&#x4EE3;&#x7801;&#x7F29;&#x5199;">4.color&#x8D4B;&#x503C;,16&#x8FDB;&#x5236;&#x989C;&#x8272;&#x4EE3;&#x7801;&#x7F29;&#x5199;</h4>
</li>
<li>&#x4E0D;&#x8981;&#x7528;&#x82F1;&#x6587;&#x8D4B;&#x503C;color&#x76F8;&#x5173;css&#x5C5E;&#x6027;</li>
<li><code>color:#eebbcc;</code>&#x5EFA;&#x8BAE;&#x5199;&#x6210;<code>color:#ebc;</code></li>
</ol>
<h3 id="5&#x7981;&#x6B62;&#x4E3A;&#x4E86;-hook-&#x811A;&#x672C;&#xFF0C;&#x521B;&#x5EFA;&#x65E0;&#x6837;&#x5F0F;&#x4FE1;&#x606F;&#x7684;-class&#x3002;">5.&#x7981;&#x6B62;&#x4E3A;&#x4E86; hook &#x811A;&#x672C;&#xFF0C;&#x521B;&#x5EFA;&#x65E0;&#x6837;&#x5F0F;&#x4FE1;&#x606F;&#x7684; class&#x3002;</h3>
<ol>
<li>&#x4E0D;&#x5141;&#x8BB8; class &#x53EA;&#x7528;&#x4E8E;&#x8BA9; JavaScript &#x9009;&#x62E9;&#x67D0;&#x4E9B;&#x5143;&#x7D20;&#xFF0C;class &#x5E94;&#x8BE5;&#x5177;&#x6709;&#x660E;&#x786E;&#x7684;&#x8BED;&#x4E49;&#x548C;&#x6837;&#x5F0F;&#x3002;&#x5426;&#x5219;&#x5BB9;&#x6613;&#x5BFC;&#x81F4; CSS class &#x6CDB;&#x6EE5;&#x3002;</li>
<li>&#x4F7F;&#x7528; id&#x3001;&#x5C5E;&#x6027;&#x9009;&#x62E9;&#x4F5C;&#x4E3A; hook &#x662F;&#x66F4;&#x597D;&#x7684;&#x65B9;&#x5F0F;&#x3002;</li>
</ol>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="0.css.html" class="navigation navigation-prev " aria-label="Previous page: CSS">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="2.css命名规范.html" class="navigation navigation-next " aria-label="Next page: CSS命名规范">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"CSS书写规范","level":"1.3.1","depth":2,"next":{"title":"CSS命名规范","level":"1.3.2","depth":2,"path":"css/2.css命名规范.md","ref":"css/2.css命名规范.md","articles":[]},"previous":{"title":"CSS","level":"1.3","depth":1,"path":"css/0.css.md","ref":"css/0.css.md","articles":[{"title":"CSS书写规范","level":"1.3.1","depth":2,"path":"css/1.css书写规范.md","ref":"css/1.css书写规范.md","articles":[]},{"title":"CSS命名规范","level":"1.3.2","depth":2,"path":"css/2.css命名规范.md","ref":"css/2.css命名规范.md","articles":[]}]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":[],"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"css/1.css书写规范.md","mtime":"2019-10-12T05:14:43.069Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-02T00:51:07.028Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

